/// @tags: GeneralSuffixAutoMaton
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

constexpr int MAXN = 1.5e5 + 3, SAMN = MAXN * 4, CHARSET = 26;

int n, k, samcnt = 1;
int len[SAMN], link[SAMN], ch[SAMN][CHARSET], cnt[SAMN];
char str[MAXN];
LL ans, f[SAMN];
vector<int> G[SAMN];

inline int extend(int c, int lst, int val) {
  if (ch[lst][c]) {
    int p = lst, q = ch[p][c];
    if (len[q] == len[p] + 1) {
      cnt[q] += val;
      return q;
    } else {
      int nq = ++samcnt;
      len[nq] = len[p] + 1;
      memcpy(ch[nq], ch[q], sizeof(ch[nq]));
      link[nq] = link[q], link[q] = nq;
      while (p && ch[p][c] == q) ch[p][c] = nq, p = link[p];
      cnt[nq] += val;
      return nq;
    }
  }
  int p = lst, np = lst = ++samcnt;
  len[np] = len[p] + 1;
  cnt[np] = val;
  while (p != 0 && ch[p][c] == 0) ch[p][c] = np, p = link[p];
  if (p == 0) {
    link[np] = 1;
    return np;
  }
  int q = ch[p][c];
  if (len[q] == len[p] + 1) {
    link[np] = q;
    return np;
  }
  int nq = ++samcnt;
  memcpy(ch[nq], ch[q], sizeof(ch[nq]));
  len[nq] = len[p] + 1;
  link[nq] = link[q];
  link[np] = link[q] = nq;
  while (p != 0 && ch[p][c] == q) ch[p][c] = nq, p = link[p];
  return np;
}

inline void insert(char str[], int slen, int val) {
  for (int i = 1, lst = 1; i <= slen; ++i) lst = extend(str[i] - 'a', lst, i >= k ? val : 0);
}

void dfs(int u) {
  f[u] = cnt[u];
  for (auto v : G[u]) {
    dfs(v);
    f[u] += f[v];
  }
  if (len[link[u]] < k && f[u] > 0) ans += f[u] * (min(len[u], k) - len[link[u]]);
}

inline void solve() {
  for (int i = 2; i <= samcnt; ++i) G[link[i]].push_back(i);
  dfs(1);
}

inline int main() {
  cin >> n >> k;
  cin >> (str + 1);
  reverse(str + 1, str + n + 1);
  insert(str, n, 1);
  cin >> (str + 1);
  reverse(str + 1, str + n + 1);
  insert(str, n, -1);
  solve();
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P6793 [SNOI2020] 字符串.in", "r", stdin);
  freopen("P6793 [SNOI2020] 字符串.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
